// 多态：父类定义一个方法不去实现，让继承它的子类去实现，
  // 每一个子类都有不同表现

// 多态属于继承
class Animal {
  name: string
  constructor(name: string) {
    this.name = name
  }
  eat() {
    console.log('吃的方法');
  }
}

class Dog extends Animal {
  constructor(name: string) {
    super(name)
  }
  eat() {
    return this.name + '吃狗粮'
  }
}
let dog = new Dog('狗狗')
console.log(dog.eat())

class Cat extends Animal {
  constructor(name: string) {
    super(name)
  }
  eat() {
    return this.name + '吃罐头'
  }
}

let cat = new Cat('猫猫')
console.log(cat.eat())

export {}